home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr35
/
dispwhen.zip
/
DISPWHEN.PPS
< prev
next >
Wrap
Text File
|
1993-04-03
|
3KB
|
102 lines
; *****************************************************************
; * *
; * DISPWHEN V 1 . 0 *
; * *
; * Written in PPL for PCBoard *
; * *
; * Designed By: Gary Meeker *
; * *
; * Began development: 04-03-93 *
; * *
; *****************************************************************
;
; This .PPE checks day, time & security level and displays a file if applicable.
; Usage:
;
; !DispWhen.PPE LowSec;HighSec;StartTime;EndTime;Days;DisplayFile
;
; Where:
; LowSec is the lowest level to display the file to
; HighSec is the highest level to display the file to
; StartTime is the Earliest time to display the file
; EndTime is the latest time to display the file
; Days is the day flags to display the file SMTWTFS (Y or N for each)
; DisplayFile is the file to be displayed
;
; Example:
;
; !DispWhen.PPE 10;80;06:00;08:00;NYYYYYN;C:\PCB\GEN\NoWay
;
; The file C:\PCB\GEN\NoWay will be displayed to any caller with a security
; level between 10 and 80 (inclusive) between the hours 6am to 8am on a
; weekday (M-F).
;
; DispWhen will properly Handle time ranges where the EndTime falls before the
; StartTime. ie.
;
; !DispWhen.PPE 10;80;23:00;01:00;;C:\PCB\GEN\NoWay
;
; Also, Days maybe left blank (as above example) and YYYYYYY will be assumed.
; (Y will be assumed for any days not specified ie NN becomes NNYYYYY)
;
STRING StartTimeSt, EndTimeSt, DaySt, DisplayFile
INTEGER SecLow, SecHigh
TIME StartTime, EndTime, CurrentTime
;Parse the command line
GETTOKEN SecLow
GETTOKEN SecHigh
GETTOKEN StartTimeSt
GETTOKEN EndTimeSt
GETTOKEN DaySt
GETTOKEN DisplayFile
; If time is in HH:MM format Adjust the string to HH:MM:SS or they
; won't convert
IF (LEN(StartTimeSt)=5) LET StartTimeSt = StartTimeSt + ":00"
IF (LEN(EndTimeSt)=5) LET EndTimeSt = EndTimeSt + ":00"
; Convert from STRING to TIME for comparisons
StartTime = StartTimeSt
EndTime = EndTimeSt
;Make sure all 7 Days are accounted for assuming Y for a short string
DaySt = LEFT(DaySt + "YYYYYYY", 7)
; Load the User info so we can get to U_SEC
GETUSER
; Get the current time
CurrentTime = TIME()
; Check the security level range - bail out if not in the desired range
IF (U_Sec < SecLow | U_Sec > SecHigh) STOP
; Check the current day of the week and if flag says N then bail out
; DOW(DATE()) returns 0-6 for Sunday-Saturday so add 1 for MID()
IF (UPPER(MID(DaySt, DOW(DATE()) + 1, 1))= "N") STOP
; See if Start time is before end time... ie. range specified as 23:00;01:00
; If not then Current Time must be within range
; If so then Current Time must appear to be outside of range
IF (StartTime <= EndTime) THEN
IF (CurrentTime < StartTime | CurrentTime > EndTime) STOP
ELSE
IF (CurrentTime < StartTime & CurrentTime > EndTime) STOP
END IF
; We passed all the criteria, show the file (allow for all types)
DISPFILE DisplayFile, LANG+SEC+GRAPH
END